<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改收款计划')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-receivable-edit" th:object="${receivablePlan}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">项目/结算：</label>
                <div class="col-sm-8">
                    <input name="title" th:field="*{title}" class="form-control" type="text" disabled>
                </div>

            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">客户：</label>
                <div class="col-sm-8">
                    <input name="customerId" th:field="*{customerName}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">计划类型：</label>
                <div class="col-sm-8">

                    <input name="planType" th:value="${receivablePlan.planType == 'staffing'  ? '外派收款' : '项目收款'}"  class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">成本中心：</label>
                <div class="col-sm-8">
                    <select name="businessUnitDepartmentId" class="form-control" th:field="*{businessUnitDepartmentId}" th:with="type=${@customDictService.selectDictBusinessUnitWithDepartments()}" required>
                        <option value="">请选择</option>
                        <optgroup th:each="unit: ${type}" th:label="${unit.name}">
                            <option th:each="department : ${unit.departments}" th:text="${department.name}" th:value="${department.id}"></option>
                        </optgroup>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">收款笔数：</label>
                <div class="col-sm-8">
                    <select name="planNumber" class="form-control" th:field="*{planNumber}" th:with="type=${@dict.getType('account_number')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{planNumber}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">计划收款金额：</label>
                <div class="col-sm-8">
                    <input name="expectAmount" th:field="*{expectAmount}" type="text" class="form-control" th:readonly="*{planType == 'staffing'}" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">计划收款时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="planReceiveDate" th:value="${#dates.format(receivablePlan.planReceiveDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">认证类型：</label>
                <div class="col-sm-8">
                    <select name="cognizanceType" class="form-control" th:with="type=${@dict.getType('cognizance_type')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{cognizanceType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">认定时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="cognizanceDate" th:value="${#dates.format(receivablePlan.cognizanceDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">已开发票：</label>
                <div class="col-sm-8">
                    <select name="invoiceStatus" class="form-control" th:with="type=${@dict.getType('sys_yes_no')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{invoiceStatus}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">上次收款时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="latestReceiveDate" th:value="${#dates.format(receivablePlan.latestReceiveDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">计划状态：</label>
                <div class="col-sm-8">
                    <select name="planStatus" class="form-control" th:with="type=${@dict.getType('receivable_status_type')}" disabled>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{planStatus}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="description" class="form-control">[[*{description}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "erp/receivable";
        $("#form-receivable-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-receivable-edit').serialize());
            }
        }

        $("input[name='planReceiveDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='latestReceiveDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='cognizanceDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>